package com.hqd.sellrelation.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hqd.sellrelation.server.entity.CommunalData;
import com.hqd.sellrelation.server.mapper.CommunalDataMapper;
import com.hqd.sellrelation.server.service.CommunalDataService;
import com.hqd.common.model.PageParams;
import com.hqd.common.mybatis.base.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class CommunalDataServiceImpl extends BaseServiceImpl<CommunalDataMapper, CommunalData> implements CommunalDataService {

    @Autowired
    private CommunalDataMapper communalDataMapper;
    /**
     * 分页查询
     *
     * @param pageParams
     * @return
     */
    @Override
    public IPage<CommunalData> findListPage(PageParams pageParams) {
        CommunalData query = pageParams.mapToObject(CommunalData.class);
        QueryWrapper<CommunalData> queryWrapper = new QueryWrapper();
//        queryWrapper.lambda()
//                .likeRight(ObjectUtils.isNotEmpty(query.getRoleCode()),BaseRole::getRoleCode, query.getRoleCode())
//                .likeRight(ObjectUtils.isNotEmpty(query.getRoleName()),BaseRole::getRoleName, query.getRoleName());
        queryWrapper.orderByDesc("create_time");
        //return communalDataMapper.selectCommunalDataList(query);
        return communalDataMapper.selectPage(pageParams,queryWrapper);
    }

}
